#!/bin/bash
exec 2>&1
set -ex

TMPFILE=$(mktemp)
cleanup() {
  rm -f "$TMPFILE"
}
trap cleanup EXIT

pdnsutil list-algorithms 2>/dev/null | tee "$TMPFILE"

for algo in RSASHA1 RSASHA1-NSEC3-SHA1 RSASHA256 RSASHA512 ECC-GOST ECDSAP256SHA256 ECDSAP384SHA384 ED25519; do
    if ! grep -E -c " $algo\$" "$TMPFILE"; then
        echo Algorithm $algo is not supported
        exit 1
    fi
done

echo success
